import React from 'react'
import {
  Route,
  Switch,
  Redirect,
  withRouter,
} from 'react-router'
import ItemsList from './itemsListCtrl'
import GetListType from './getListType'

const ImageListRouter = ({ match }) => {
  return (
    <Switch>
      <Route exact={false} path={`${match.url}/unfinished/:imgId?/:labelId?`} component={ItemsList} />
      <Route exact={false} path={`${match.url}/finished/:imgId?/:labelId?`} component={ItemsList} />
      <Route exact={false} path={`${match.url}/reopend/:imgId?/:labelId?`} component={ItemsList} />
      <Route exact path={`${match.url}/`} component={GetListType} />
      <Redirect to="/error" />
    </Switch>
  )
}

export default withRouter(ImageListRouter)
